package com.ruoyi.service.impl;


import com.github.pagehelper.PageHelper;


import com.ruoyi.mapper.MaterielTwoMapper;
import com.ruoyi.domain.MaterielTwo;
import com.ruoyi.service.MaterielTwoService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class MaterielTwoServiceImpl implements MaterielTwoService {

    @Autowired
    MaterielTwoMapper materielTwoMapper;

    @Override
    public Map<String, Object> allMaterielTwo(int page, int limit)  {
        List<MaterielTwo> materielTwos = materielTwoMapper.selectAll();
        PageHelper.startPage(page,limit);
        Map<String, Object> result = new HashMap<>();
        result.put("total",materielTwos.size());
        result.put("data", materielTwoMapper.selectAll());
        return result;
    }
    @Override
    public Map<String, Object> selectMaterielTwo(int page, int limit, String lotCode, String itemCode1, String docDate) {
        List<MaterielTwo> materielTwos = materielTwoMapper.selectMaterielTwo(lotCode,itemCode1,docDate);
        PageHelper.startPage(page,limit);
        Map<String, Object> result = new HashMap<>();
        result.put("total", materielTwos.size());
        result.put("data", materielTwoMapper.selectMaterielTwo(lotCode,itemCode1,docDate));
        return result;
    }
}
